﻿/**************************************************************
 * Copyright Eastmoney Corporation. All rights reserved.
 * 
 * Author: guitao(guitao@eastmoney.com) 
 * Create Date: 2020/10/30 16:46:04
 * Description:
 *          
 * Revision History:
 *      Date         Author               Description
 *              
***************************************************************/

using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Text;

namespace QuartzJob.Sample
{
    //通常情况下 不应该将IDisposebale接口 注册为 Transient or Scope。改用工厂模式创建
    public interface IDisposableService : IDisposable
    {
    }

    public class DisposableService : IDisposableService
    {
        private ILogger<DisposableService> _logger;

        public DisposableService(ILogger<DisposableService> logger)
        {
            _logger = logger;
        }

        public void Dispose()
        {
            _logger.LogInformation($"{nameof(DisposableService)} has disposed at {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}.");
        }
    }
}
